package com.typhoon.configuation;

/**
 * @author shuya | dongfeng.zdf@alibaba-inc.com
 * @description
 * @date 2018/10/10 下午4:19
 * @description
 * @modified by
 * @since V2.0.0
 */
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

import javax.sql.DataSource;

/**
 * druid配置类
 *
 */
@Configuration
@PropertySource(value = "classpath:tomcat.properties")
public class TomcatJdbcConfiguration {

    private static final Logger logger = LoggerFactory.getLogger(TomcatJdbcConfiguration.class);

    @Bean("tomcatDataSource")
    @ConfigurationProperties(prefix = "spring.datasource")
    public DataSource tomcatDataSource() {
        logger.info("tomcat数据库连接池创建中.......");
        org.apache.tomcat.jdbc.pool.DataSource ds = new org.apache.tomcat.jdbc.pool.DataSource();
        return ds;
    }
}